#ifndef _THREADPOOL_H
#define _THREADPOOL_H

//#include "02_TaskQueue.cpp"   // 报错，重复定义
#include "02_TaskQueue.hpp"
#include "06_Thread.hpp"
#include <memory>
#include <vector>

using std::unique_ptr;
using std::vector;

class Task;

class ThreadPool
{
public:
    ThreadPool(int, int);
    ~ThreadPool() = default;
    void start();
    void stop();
    void addTask(Task*);
    void doTask();
    bool get_is_exit();

private:
    vector<unique_ptr<Thread>> _threads;
    int _thread_num;
    int _que_size;
    TaskQueue _task_que;
    bool _is_exit;

};

#endif

